<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>沃店</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="{{assets}}i/favicon.png">
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="{{assets}}i/app-icon72x72@2x.png">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <link rel="stylesheet" href="../assets/css/amazeui.min
.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/app.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/index.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/jquery-labelauty.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/uploadView.css">
    <!--必要样式-->
    <style type="text/css">
        body {
            background-color: #fff;
        }

        .order {
            margin-top: 20px;
        }

        .idphoto {
            overflow: auto;
            border: 1px solid #ccc;
            border-radius: 5px;
            height: 130px;
            width: 100%;
        }

        .js_showBox {

        }

        .js_uploadBox {
            margin-top: 10px;
        }

        .file {

            /*border: 1px #ccc solid;
    padding: 5px;

    border-radius: 5px;
    opacity: 0;*/
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
            width:100px;
        }

        .file-show {
            display: block;
            padding: 10px 5px;
            background-color: #fff;
            width: 100%;
            position: relative;
            cursor: pointer;
            color: #888;

            border: 1px solid #ddd;
            border-radius: 4px;
            overflow: hidden;

        }
        .file-show span {
            width: 100%;
        }
    </style>
</head>

<body>
<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
    <div class="am-header-left am-header-nav">
        <a href="${pageContext.request.contextPath}/clientHome/userInfo" class="">
            <i class="am-header-icon am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="#title-link" class="">
            申请
        </a>
    </h1>
    <div class="am-header-right am-header-nav">
        <a href="#right-link" class="">
            <i class="am-header-icon am-icon-home"></i>
        </a>
    </div>
</header>
<div class="am-g">
    <div class=" am-u-sm-12" style="color:#FEB74D;padding:20px 0;">
        <span style="font-size: 18px;font-weight: bold;margin-left: 40px;margin-right: 10px; ">开店</span><span
            style="font-size: 14px;font-weight: bold;">沃店商家</span>
    </div>
</div>
<form class="am-form" enctype="multipart/form-data" method="post"
      action="${pageContext.request.contextPath}/clientUserShop/register">
    <fieldset>
        <div class="am-form-group">
            <label class="font_orange">店铺名称</label>
            <input type="text" class="" name="shopName">
        </div>

        <div class="am-g order">
            <div class="clearpadding am-u-sm-12">
                <select data-am-selected id="area" name="categoryId">
                    <option>店铺分类选择</option>
                    <option v-for="item in regionlist" v-bind:value="item.id">{{item.categoryName}}</option>
                </select>
            </div>
        </div>

        <div class="am-form-group">
            <label class="font_orange">地址</label>
            <input type="text" class="" name="address">
        </div>
        <%--<div class="am-form-group">--%>
        <%--<label for="doc-select-1" class="font_orange">店铺类型</label>--%>
        <%--<select id="doc-select-1" style="border-radius: 5px;">--%>
        <%--<option value="option1">选项一...</option>--%>
        <%--<option value="option2">选项二.....</option>--%>
        <%--<option value="option3">选项三........</option>--%>
        <%--</select>--%>
        <%----%>
        <%--</div>--%>
        <div class="am-form-group">
            <label class="font_orange">店铺图片</label>
            <a href="#" class="file-show">
                <input type="file" class="file" placeholder="" name="shopImage"><span>点击上传</span>
            </a>
        </div>
        <div class="am-form-group">
            <label class="font_orange">营业执照</label>
            <a href="#" class="file-show">
                <input type="file" class="file" placeholder="" name="businessLicense"><span>点击上传</span>
            </a>
        </div>

        <div class="am-form-group">
            <label class="font_orange">联系电话</label>
            <input type="text" class="" name="phone">
        </div>
        <div class="am-form-group">
            <label class="font_orange">身份证号</label>
            <input type="text" class="" name="card">
        </div>
        <div class="am-form-group" style="overflow: auto;">
            <label class="font_orange">身份证照片</label>
            <div class="am-g idphoto">
                <div class="control-group js_uploadBox">
                    <div class="am-u-sm-6 " id="divi" onclick="deleteInput('i')">
                        <div class="btn-upload">
                            <a href="javascript:void(0);"><i class="am-icon-picture-o am-icon-md"
                                                             style="color:rgba(0,0,0,0.4)"></i><span
                                    class="js_uploadText" style="font-size:24px"></span></a>
                            <input id="js_upFile" class="js_upFile" type="file" name="cardImages">
                        </div>
                        <div class="js_showBox"></div>
                    </div>
                </div>
            </div>
        </div>

        <div class="am-g" align="center" onclick="sub()">
            <img src="${pageContext.request.contextPath}/images/submit_order.png">
        </div>
    </fieldset>
</form>
<!--[if (gte IE 9)|!(IE)]><!-->
<script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/amazeui.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/jquery-labelauty.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/jquery.uploadView.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/jquery.uploadView.add.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/vue.js"></script>
<script src="${pageContext.request.contextPath}/layer/layer.js"></script>
<script type="text/javascript">
    $(".file-show").on("change", "input[type='file']", function () {
        var filePath = $(this).val();
        var w = $(this).width();
        $(this).width($(this).next().width()+"px");
        $(this).next().text(filePath.substring(0,10)).width(w+"px");
    });

    var area = new Vue({
        el: "#area",
        data: {
            regionlist: []
        }
    });
    $.ajax({
        type: "get",
        async: false,
        url: '${pageContext.request.contextPath}/clientShopCategory/findAll',
        dataType: 'json',
        success: function (data) {
            if (data.success == true && data.code == 200) {
                area.regionlist = data.obj;
            }
            $("#area").change(function () {
                var html = $(".am-selected-status").text();
                html = "片区选择" + "<font style='color:#000;margin-left:10px;'>" + html + "</font>";
                $(".am-selected-status").text("").html(html);
            });
        },
        error: function () {
            layer.msg('网络超时');
        }

    });

    var isSubmit = 0;

    function sub() {
        if ($("input[name='shopName']").val() == "") {
            layer.msg('请填写店铺姓名');
            return;
        }
        if ($("#area").val() == "店铺分类选择") {
            layer.msg('请选择店铺分类');
            return;
        }

        if ($("input[name='address']").val() == "") {
            layer.msg('请填写地址');
            return;
        }
        if ($("input[name='shopImage']").val() == "") {
            layer.msg('请上传店铺图片');
            return;
        }
        if ($("input[name='businessLicense']").val() == "") {
            layer.msg('请上传营业执照');
            return;
        }
        if ($("input[name='phone']").val() == "") {
            layer.msg('请填写联系电话');
            return;
        }
        if ($("input[name='card']").val() == "") {
            layer.msg('请填写身份证号');
            return;
        }
        if ($("input[name='cardImages']").length != 2 || $("input[name='cardImages']").eq(1).val() == "") {
            layer.msg('请上传身份证正反面');
            return;
        }
        if (isSubmit == 0) {
            $(".am-form").submit();
            isSubmit = 1;
        } else {
            layer.msg('您已经提交订单了！');
        }
    }
</script>
</body>

</html>
